package com.mhjy.synchro.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mhjy.synchro.repository.entity.RefundApplicationDetailEntity;
import com.mhjy.synchro.repository.mapper.RefundApplicationDetailMapper;
import com.mhjy.synchro.repository.model.BaseResultModel;
import com.mhjy.synchro.service.IRefundApplicationDetailService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RefundApplicationDetailService extends ServiceImpl<RefundApplicationDetailMapper, RefundApplicationDetailEntity> implements IRefundApplicationDetailService {

    @Override
    public BaseResultModel GetAll() {
        QueryWrapper<RefundApplicationDetailEntity> wapper = new QueryWrapper();
        List<RefundApplicationDetailEntity> list = baseMapper.selectList(wapper);
        if (list != null && list.size() <= 0)
            return new BaseResultModel(99, "查询数据为空");
        else
            return new BaseResultModel(0, "", list);
    }

    @Override
    public BaseResultModel GetSynchroRecord() {
        QueryWrapper<RefundApplicationDetailEntity> wapper = new QueryWrapper();
        wapper.isNull("syncTag").or().eq("syncTag", 0);
        List<RefundApplicationDetailEntity> list = baseMapper.selectList(wapper);
        if (list != null && list.size() <= 0)
            return new BaseResultModel(99, "查询数据为空");
        else
            return new BaseResultModel(0, "", list);
    }
}
